package config

import (
	"github.com/spf13/viper"
	"inspector/pkg/log"
)

type ServerConfig struct {
	Name    string `mapstructure:"name"`
	Address string `mapstructure:"address"`
	Port    int    `mapstructure:"port"`
}

var serverConfig ServerConfig

func initServerConfig(v *viper.Viper) {
	err := v.Sub("server").Unmarshal(&serverConfig)
	if err != nil {
		log.Error(err.Error())
	}
}

func (c *Config) GetServerConfig() ServerConfig {
	return serverConfig
}
